package com.youth.vodtest;

import com.aliyun.oss.ClientException;
import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.vod.model.v20170321.GetVideoPlayAuthRequest;
import com.aliyuncs.vod.model.v20170321.GetVideoPlayAuthResponse;
import com.youth.vod.utils.AliyunVodSDKUtils;
import org.junit.Test;


/**
 * @Author：CM
 * @Package：com.youth.vodtest
 * @Project：youth-college
 * @name：git
 * @Date：2023/5/6 16:07
 * @Filename：git
 */
public class testUpload {


    @Test
    public void testGetVideoPlayAuth() throws ClientException {


        //初始化客户端、请求对象和相应对象

        DefaultAcsClient client = AliyunVodSDKUtils.initVodClient("LTAI5tDBqBZ7AGzRFDtcUrCb", "e4iWQFT3Lijsyggqc0hJyqhPhlBjNw");

        GetVideoPlayAuthRequest request = new GetVideoPlayAuthRequest();

        GetVideoPlayAuthResponse response = new GetVideoPlayAuthResponse();

        try {


            //设置请求参数

            request.setVideoId("3f5b55c0ebe271ed80357621b7ad0102");

            //获取请求响应

            response = client.getAcsResponse(request);


            //输出请求结果

            //播放凭证

            System.out.print("PlayAuth = " + response.getPlayAuth() + "\n");

            //VideoMeta信息

            System.out.print("VideoMeta.Title = " + response.getVideoMeta().getTitle() + "\n");

        } catch (Exception e) {

            System.out.print("ErrorMessage = " + e.getLocalizedMessage());

        }


        System.out.print("RequestId = " + response.getRequestId() + "\n");

    }


}
